package com.msmall.community.admin.action;

import java.io.File;

import com.msmall.base.action.HTMLBaseAction;
import com.msmall.base.util.ConstantUrl;
import com.msmall.community.common.model.Sight;
import com.msmall.community.common.service.SightManager;

public class SightAction extends HTMLBaseAction{
	  
	private static final long serialVersionUID = -1514663055247517410L;
	private Long sightid;
	private File image;
	private String imageContentType; // 文件的内容类型
	private String imageFileName; // 上传文件名
	private Sight sight;
	private SightManager sightManager;

	public String execute(){
		page.setClazz(Sight.class);
		page.setOrderBy("sightid");
		page.setOrder("desc");
		sightManager.getPagination(page);
		page.setUrl(ConstantUrl.ADMIN_SIGHT_INDEX);
		return SUCCESS;
	}
	
	public String create(){
		sightid = null;
		sight = null;
		return SUCCESS;
	}
	
	public String update(){
		sight = (Sight) sightManager.get(Sight.class, sightid);
		return SUCCESS;
	}
	
	public String save(){
		sightManager.saveSight(image, imageFileName, sight, getUserAgentType(), getUserid());
		return SUCCESS;
	}

	public Long getSightid() {
		return sightid;
	}

	public void setSightid(Long sightid) {
		this.sightid = sightid;
	}

	public File getImage() {
		return image;
	}

	public void setImage(File image) {
		this.image = image;
	}

	public String getImageContentType() {
		return imageContentType;
	}

	public void setImageContentType(String imageContentType) {
		this.imageContentType = imageContentType;
	}

	public String getImageFileName() {
		return imageFileName;
	}

	public void setImageFileName(String imageFileName) {
		this.imageFileName = imageFileName;
	}

	public Sight getSight() {
		return sight;
	}

	public void setSight(Sight sight) {
		this.sight = sight;
	}

	public void setSightManager(SightManager sightManager) {
		this.sightManager = sightManager;
	}
}
